
const request = require('../../../../utils/request');

Page({
    data: {
        mobile: '',
        sessionId: '',
        userId: ''
    },
    onLoad: function(e) {
        console.log(e.sessionId)
        this.setData({
            sessionId: e.sessionId,
            userId: e.userId
        })
    },
    onReady: function(){
        wx.setNavigationBarTitle({
            title: '手机号'
        })
    },
    toNext() {
        console.log(this.data.mobile)
        request.HttpRequst(true, "program/send", false, "", { "mobile": this.data.mobile }, "POST",false, res => {
            console.log(res)
            if(res.code == 200){
                wx.navigateTo({
                    url: '../sendCode/sendCode?mobile='+this.data.mobile+'&sessionId='+this.data.sessionId+ '&userId='+this.data.userId
                })
            }else{
                wx.showModal({
                    title: '提示',
                    content: '请检查手机号是否正确',
                    showCancel: false
                })
            }
        })
    },
    bindMobile(e) {
        this.setData({
            mobile: e.detail.value
        })
    }
})